package com.neusoft.controller;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.neusoft.model.BooksModel;
import com.neusoft.model.entity.Appointment;
import com.neusoft.model.entity.Books;
import com.neusoft.model.entity.Borrow_history;
import com.neusoft.model.entity.User;
import com.neusoft.model.vo.BooksModelVO;
import com.neusoft.service.AppointmentService;
import com.neusoft.service.BooksService;
import com.neusoft.service.HistoryService;

@Controller
@RequestMapping("/renewbook")
public class RenewBookController {

	@Autowired
	BooksService booksService;


	@RequestMapping("/renewone")
	private String renewone(String book_id){	
		Books book=new Books();
		book.setId(Integer.valueOf(book_id));
		Books bookTmp=booksService.findBooksbyID(Integer.valueOf(book_id));
		Calendar cal = Calendar.getInstance();
		cal.setTime(bookTmp.getDeadline());
		cal.add(Calendar.MONTH,1);
		book.setDeadline(cal.getTime());
		booksService.updateBooksbyID(book);
		return "mylibrary";
	}
	
	
}
